<?php
require_once 'base.php';

$tpl = new Template('t');
$tpl->setFile ( "rss", "rss.xml" );
$tpl->setBlock ( "rss", "item", "items" );

$db = conn();

$where = " WHERE status>-1";

$sql = "SELECT * FROM article" . $where . " ORDER BY id DESC";
$rs=$db->query($sql, MYSQL_ASSOC);
foreach($rs as $v){
	$tpl->setVar(array(
		"aid" => $v['aid'],
		"title" => stripslashes($v['title']),
		"headline" => stripslashes($v['headline']),
		"submit_time" => date("Y-m-d H:i", $v['submit_time'])
	));
	$tpl->parse ("items", "item", true);
}

$db->close();

$tpl->p("rss");
?>